//////////////////////////////////////////////////////////////////////////////
// Timer.h
// =======
// High Resolution Timer.
// This timer is able to measure the elapsed time with 1 micro-second accuracy
// in both Windows, Linux and Unix system 
//
//  AUTHOR: Song Ho Ahn (song.ahn@gmail.com)
// CREATED: 2003-01-13
// UPDATED: 2006-01-13
//
// Copyright (c) 2003 Song Ho Ahn
//
//////////////////////////////////////////////////////////////////////////////
//	Modified for the klas engine.
//////////////////////////////////////////////////////////////////////////////

#ifndef _KLAS_TIMER_HPP_
#define _KLAS_TIMER_HPP_

#include "../include/Defines.hpp"
#include "../include/Libs.hpp"

namespace klas
{
	//! Timer is a portable, high-resolution (1 ms accuracy) timer.
	class Timer
	{
		public:
			//! Ctor.  Starts the timer.
			Timer();
			
			//! Dtor.
			~Timer();
			
			//! Restarts the timer.
			void restart();
			
			//! Stops the timer.
			void stop();
						
			//! Is the timer running?
			/*! \return True if the timer is running. */
			bool isRunning();
	
			//! How many seconds have elapsed since the timer was last restarted?
			/*! \return The number of elapsed seconds. */
			Real getSeconds();
			
			//! How many milliseconds have ellapsed since the timer was last restarted?
			/*! \return The number of elapsed milliseconds. */
			Uint32 getMilliseconds();
			
			//! How many microseconds have elapsed since the timer was last restarted?
			/*! \return The number of elapsed microseconds. */
			//long long getMicroseconds();
		
			
		private:
		
			Uint32 m_startMilli, m_endMilli;
			bool m_stopped;
			
			/*Real m_startTimeInMicro,
					 m_endTimeInMicro;
					 
			bool m_stopped;
					 
			#ifdef KLAS_WINDOWS
			LARGE_INTEGER m_frequency, // ticks per second
										m_startCount, m_endCount; // starting / ending ticks.
			#endif
			
			#ifdef KLAS_LINUX
			timeval m_startCount,
							m_endCount;
			#endif*/
	};
}

#endif
